package com.firebird.app.kotlin.stock.ui.godeal.tab.tab_haved

import android.R
import android.graphics.Color
import androidx.annotation.NonNull
import androidx.annotation.Nullable
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.firebird.app.kotlin.stock.data.DetailsDealBean.PositionsBean
import com.firebird.app.kotlin.stock.R
import com.firebird.app.kotlin.stock.data.DetailsDealBean


class Adp(layoutResId: Int, @Nullable data: List<PositionsBean?>?) : BaseQuickAdapter<PositionsBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(@NonNull helper: BaseViewHolder, item: PositionsBean) {
        helper.setText(R.id.item_name, item.sharesName)
                .setText(R.id.item_nowprice, item.nowPrice)
                .setText(R.id.item_code, item.sharesCode)
                .setText(R.id.item_buyprice, item.buyPrice)
                .setText(R.id.item_haved, item.nowNum + "")
                .setText(R.id.item_yingkui, item.earnAmt)
                .setText(R.id.item_yinkuibi, item.earnAmtRatio + "")
                .setTextColor(R.id.item_yingkui, if (item.earnAmt!!.contains("-")) Color.parseColor("#06b96a") else Color.parseColor("#ff3025"))
                .setTextColor(R.id.item_yinkuibi, if (item.earnAmt!!.contains("-")) Color.parseColor("#06b96a") else Color.parseColor("#ff3025"))
                .setText(R.id.item_cansell, item.canSellNum + "")
    }
}